package cn.wbnyua.resume.api.api2;

import cn.wbnyua.resume.mvc.domain.MySelf;
import cn.wbnyua.resume.mvc.service.v2.MySelfService;
import cn.wbnyua.resume.util.JsonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/7 14:15.
 */
@RestController
@RequestMapping("/api/myself")
public class MyselfApi {
    @Autowired
    private MySelfService service;

    @GetMapping
    public JsonResponse<MySelf> list(){
        return new JsonResponse<>(service.find());
    }

//    @PostMapping
//    public JsonResponse<String> login(String account,String password){
//        boolean result = service.login(account, password);
//        if (result){
//            return JsonResponse.success();
//        }else {
//            return JsonResponse.failed();
//        }
//    }

    @PutMapping
    public JsonResponse<String> update(MySelf mySelf){
        service.update(mySelf);
        return JsonResponse.success();
    }


}
